<div th:fragment="header" xmlns:th="http://www.thymeleaf.org">
  <div class="fly-header layui-bg-black">
    <div class="layui-container">
      <a class="fly-logo" th:href="@{/}">
        <!--<img style="height: 45px;" th:src="@{/images/logo.png}" alt="青少年传习论坛">-->
          <span style="color: #63ba7c; font-size: 28px; font-family: layui-icon; display: block;">崇华</span>
      </a>
      <ul class="layui-nav fly-nav layui-hide-xs">
        <li th:each="label:${labels}" th:class="${label?.id==selabel?'layui-nav-item layui-this':'layui-nav-item'}">
          <a th:href="@{'/?label=' + ${label?.id}}"><i class="iconfont icon-jiaoliu"></i><span th:text="${label?.name}"></span></a>
        </li>
      </ul>

          <ul class="layui-nav fly-nav-user" th:if="${user == null}">
            <!-- 未登入的状态 -->
            <li class="layui-nav-item">
              <a class="iconfont icon-touxiang layui-hide-xs" th:href="@{/user/login}"></a>
            </li>
            <li class="layui-nav-item">
              <a th:href="@{/user/loginPage}">登入</a>
            </li>
            <li class="layui-nav-item">
              <a th:href="@{/user/regPage}">注册</a>
            </li>
          </ul>
        <ul class="layui-nav fly-nav-user" th:if="${user != null}">
            <!-- 登入后的状态 -->
            <li class="layui-nav-item">
                <a class="fly-nav-avatar" href="javascript:;">
                    <cite class="layui-hide-xs" th:text="${user?.username}"></cite>
                    <i class="iconfont icon-renzheng layui-hide-xs" th:text="${user?.roleName}"></i>
                    <img th:src="@{${user?.portrait}}">
                </a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/user/set}"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
                    <dd><a th:href="@{/user/message}"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a></dd>
                    <dd><a th:href="@{/user/home}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
                    <dd th:if="${user?.roleId == 'teacher'}"><a th:href="@{/approve/index}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe6b2;</i>日记审批</a></dd>
                    <dd th:if="${user?.roleId == 'sys_admin'||user?.roleId == 'teacher'}"><a th:href="@{/org/user}"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe770;</i>用户管理</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a th:href="@{/user/logout}" style="text-align: center;">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
  </div>
</div>